{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/matplotlib/cbook/deprecation.py:106: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.\n",
      "  warnings.warn(message, mplDeprecation, stacklevel=1)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAADMCAYAAAB3NARbAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl0VHW26PHvzjwzhDAGCCoqIjRoQBQa0VaGdkB9XsXp4m29tLaux3suW7HH2167V0/v2lfbRu2+DlftaystijYyyqACmjAqYyIJSSBABEIISSpD7ffHOYmVUEkqZKhKan/WqpVTvzPUrkpydp3fcH6iqhhjjDH1IoIdgDHGmNBiicEYY0wjlhiMMcY0YonBGGNMI5YYjDHGNGKJwRhjTCOWGIwxxjRiicEYY0wjlhiMMcY0YonBGGNMI1HBDqAt+vXrpxkZGcEOwxhjup3Nmzd/rappgWzbrRJDRkYG2dnZwQ7DGGO6HRE5EOi2VpVkjDGmkW51xWCMCU9bd+awfH0WpWXl9E5JYsbUCYwfPTLYYfVYlhiMMSFt684c3ln2MTW1tQCUlpXzzrKPASw5dJJunxhqamooKiqiqqoq2KGYFsTFxZGenk50dHSwQzHdzPL1WQ1JoV5NbS3L12dZYugk3T4xFBUVkZycTEZGBiIS7HCMH6rKsWPHKCoqYsSIEcEOx3Qjp8orKC0r97uutKycj7N2MCgtlYFpfUlKjG/2OFYV1TbdPjFUVVVZU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NaGmuR9CSVRsQEaKjooiOiiQqOooYn+XoqChioqOIiopkx579LG7yf/fB6o0AXHDOUGZfO4ULzx1GZGTnjLedMXVCo/97cKqibrp2SqP/e1WlospDaVk5J8vKOXnqNKVl5az7bLvf43qqa8jesRd1961/oD7PW4irts5L397JpA9MIzEhjoT4WBLi4khIiCMxPo6EuFgSEuL446uL/SaB3ilJZ/uRtEpUWwodRCQS2AdcCxQBWcAdqrrLZ5urgM9UtUJEHgSmqertTY7TF8gF0t3tXgE+UNVFgQabmZmpTW+JsXv3bkaNGgXA+6s2cOjosWb3Lzh0xG9WjoyMYNjgAX73Gdw/lRuuuaLFuOpv1dGvXz/KyspISEggKiqKVatWsXDhQv7+9783qkq64YYbWLBgAZMnT6a8vJy4uDg++ugjFi1axAsvvICqcuONN/LYY48xderURq8lIixZsoQbbriBxx57jJSUFH7yk59w55138oMf/IApU6ZQUFDAjBkz2L17Nw8//DBDhgzhiSeeYNmyZcyaNYuSkhL69evH8ePH6du3L5WVlUyYMIF169aRmprakAjq1T9fvHgx7777Lq+++irV1dWce+657Nu3j9dee42jR4/yk5/8BI/Hw+TJk3n77bfP6IHk+7syoam6uoaDR76msLiEouKj7Nizv9NeKyUpgR89dHenHd9Xe2oKfr3wr82emBc8eGen79/0Cy1808bSli+0IrJZVTMD2TaQK4aJQK6q7ncP/iYwG2hIDKq6xmf7TYC/3/atwIeqWhFIYJ2huUu1tl7CteTkyZPMnTuXnJwcRISampoztpk8eTKPPPIId911F7fccgvp6emsWLGCFStWMH78eADKy8vJyck5IzHExMRw/fXXA3DppZeycuVKAFatWsWuXQ2/EsrKyigvL+eTTz5h8eLFAMycOZM+ffo0bPPMM880rCssLCQnJ4fU1NRm39usWbOYP38+Ho+HZcuWMXXqVOLj41mxYgU7duxg0aJFDZ9BTk6OdU3tIJ3V8On1ejny9YmGJFBYXMKRkuMN1SZ9eiUTHRV1xhUDOCf1++dcT01NLTW19Y+6hue1PssrPvZ/f7Oy8q47FbSlKqqp5q44Zky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icgtwMtAuqqeauvnZExrrCrJ9BiqWuuejC8EslR1BzAQOKKq61U1v7mk4LoU+LFbRVQuIuU43+gT3ePU29hkv40408YCjAIO1ScFN679wCGfbcbjTO3Zkh1Nnh8C+rvLK3FuwpcnIm+IyNz6O+Aa0xGsTtL0GCKyExgORAMR7ok9Cohylw+o6ugWDhEB/AKniqipkg4IsS2X5zV+9o0AUNVTInIJMBW4FngC+JWITFDVQx0QpwlzdsVgepLv4szudRi4213+Evg/7vJ3W9l/C06VUK6fh2/d/aQm+00CdrvLu4HBIpJRv9KtShoM7HKLtgLfaeN7a8S9OvpIVZ8AxuJc1VzfnmMaU8+uGEyPoaoHRGQgzhwS7+F8yx4N/N1nruWWPAl8ICIHgLeAWuBiYKKqPuaz3SQReQJYhDNnwD8Dd7nrVuFUA70hIvPdsmdxks5H7vNfAu+LSC5OVZXgND6/oKoVrQUpItfjTHG5HjiO0wCezDfJyZh2sSsG09NMw2lfqMKZ+rEowKSAqi7HaaS+CvjcfSzAabT29R8439K3Ak8BP1PVRe4xFJiNU/W0xn0cBm5y16GqS3FmIJvlHmOd+5reAN9jKXATThLaAzwK3K+qHwe4vzEtsl5JxrSB22Poj6r6+2DHYkxnsSsGY4wxjVhiMMYY04hVJRljjGnErhiMMcY0YonBGGNMI5YYjDHGNGKJwRhjTCOWGIwxxjRiicEYY0wj/x9S43sOnq5oCQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f644b42f550>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import os\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from matplotlib.ticker import NullFormatter  # useful for `logit` scale\n",
    "\n",
    "def read_data(input_dir):\n",
    "    with open(os.path.join(input_dir, 'fn_ratio.dat')) as f:\n",
    "        y1 = [float(x) for x in f][:20]\n",
    "    with open(os.path.join(input_dir, 'hit_ratio.dat')) as f:\n",
    "        y2 = [float(x) for x in f][:20]\n",
    "    return y1, y2\n",
    "\n",
    "model_dir = '/export/home/xilin/Projects/dtt/model/umls-point-xavier-n/a-200-200-3-0.001-0.3-0.1-0.9-400-0.05/'\n",
    "\n",
    "# hit ratio vs. false negative ratio\n",
    "fig = plt.figure(figsize=(5.5,2.5))\n",
    "y1, y2 = read_data(model_dir)\n",
    "x = np.arange(len(y1))\n",
    "plt.plot(x, y1, '-o', color='lightslategray')\n",
    "# plt.yticks(np.arange(min(y1), max(y1), 0.05))\n",
    "ax = plt.axes()\n",
    "# ax.set_yticklabels(('22.5%', '27.5%', '32.5%', '37.5%', '42.5%'))\n",
    "plt.xticks(np.arange(0, 20, 5.0))\n",
    "# plt.plot(x, y2, '-o')\n",
    "# plt.yscale('linear')\n",
    "plt.xlabel('# epochs', fontsize=14)\n",
    "plt.legend((r'false negative', r'hit'))\n",
    "\n",
    "# Format the minor tick labels of the y-axis into empty strings with\n",
    "# `NullFormatter`, to avoid cumbering the axis with too many labels.\n",
    "plt.gca().yaxis.set_minor_formatter(NullFormatter())\n",
    "# Adjust the subplot layout, because the logit one may take more space\n",
    "# than usual, due to y-tick labels like \"1 - 10^{-3}\"\n",
    "plt.subplots_adjust(top=0.92, bottom=0.08, left=0.10, right=0.95, hspace=0.25,\n",
    "                    wspace=0.35)\n",
    "\n",
    "plt.show()\n",
    "fig.tight_layout()\n",
    "fig.savefig('training_false_negatives.pdf')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
